const express = require('express')
const { createProxyMiddleware } = require('http-proxy-middleware')
const app = express()
app.listen(3001, () => {
    console.log('shop:端口号3001已经启动了!!!');
})

//proxy跨域
var proxy = createProxyMiddleware({
    target: 'http://localhost:3000',
    changeOrigin: true,
})

app.use(express.static('public'))

app.use((req, res) => {

    proxy(req, res)
})